Conversation
|
🤖 SemverChecks 🤖 Click for details |
sangho2
left a comment
There was a problem hiding this comment.
Looks good to me. Thanks!
I've left some minor comments. Also, it would be great if this PR has some description :)
| #[derive(Clone, Copy, Default, FromBytes)] | ||
| pub struct OpteeSmcArgs { | ||
| args: [usize; Self::NUM_OPTEE_SMC_ARGS], | ||
| pub args: [usize; Self::NUM_OPTEE_SMC_ARGS], |
| let page_index = (shm_info.page_offset + offset) / PAGE_SIZE; | ||
| let offset_in_page = (shm_info.page_offset + offset) % PAGE_SIZE; |
There was a problem hiding this comment.
it might better to do shm_info.page_offset.checked_add(offset).ok_or(OpteeSmcReturnCode::EBadAddr)?; to deal with potential integer overflow attacks. Also, we don't have to compute this twice.
| } | ||
| let msg_args_addr = shm_info.page_addrs[page_index].as_usize() + offset_in_page; | ||
|
|
||
| let (msg_args, rpc_args) = read_optee_msg_args_from_phys(msg_args_addr, true)?; |
There was a problem hiding this comment.
LiteBox has read_data_from_shm which reads from offset 0. Could you add another method to read with an offset and use that method here?
| msg_args_phys_addr: msg_args_addr as u64, | ||
| }) | ||
| } | ||
| OpteeSmcFunction::CallWithRegdArg => { |
There was a problem hiding this comment.
just curios, when is this method invoked?
There was a problem hiding this comment.
On the VTL0 side, the optee_smc_do_call_with_arg() function will pass OPTEE_SMC_CALL_WITH_REGD_ARG if the tee shared memory was dynamically allocated
No description provided.